<template>
	<div>
		<el-tabs v-model="activeName" @tab-click="handleClick">
			<el-tab-pane label="公司列表" name="first">
				<el-row :gutter="24">
					<el-col :span="1" style="margin-right:10px;">
						<p class="queryLabel">公司名称:</p>
					</el-col>
					<el-col :span="4">
						<el-input :maxlength="200" size="small" v-model="condition.insuranceCompanyName" placeholder="请输入公司名称">
						</el-input>
					</el-col>
					<el-col :span="1" style="text-align: right">
						<el-button type="primary" size="small" v-on:click='companyQuery'>查询</el-button>
					</el-col>
					<el-col :span="18" style="margin-left: -10px;text-align: right">
						<el-button type="primary" size="small" v-on:click='add' v-if="btnGroup.add">新增</el-button>
						<el-button type="primary" size="small" v-on:click='editCom' v-if="btnGroup.edit">编辑</el-button>
						<el-button type="primary" size="small" v-on:click='startCom' v-if="btnGroup.start">启用</el-button>
						<el-button type="primary" size="small" v-on:click='stopCom' v-if="btnGroup.stop">停用</el-button>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChange">
							<el-table-column type="selection" width="60">
							</el-table-column>
							<el-table-column label="名称" prop="insuranceCompanyName">
							</el-table-column>
							<el-table-column label="简称" align="right" prop="insuranceCompanyCode">
							</el-table-column>
							<el-table-column label="负责人" align="right" prop="responsiblePerson">
							</el-table-column>
							<el-table-column label="联系电话" align="right" prop="conntactPhone">
							</el-table-column>
							<!--<el-table-column label="起始日期" align="right" prop="insuranceStartDate">
							</el-table-column>
							<el-table-column label="终止日期" align="right" prop="insuranceStopDate">
							</el-table-column>-->
							<!--<el-table-column label="交强险合同编号" align="right" prop="contractJqNo">
							</el-table-column>
							<el-table-column label="商业险合同编号" align="right" prop="contractSyNo">
							</el-table-column>-->
							<el-table-column label="状态" align="right" prop="status" :formatter="statusCov">
							</el-table-column>
							<el-table-column label="排列顺序" align="right" prop="sort">
							</el-table-column>
							<el-table-column label="操作" align="right" width="280">
								<template scope="scope">
									<el-button type="primary" size="small" @click.native.prevent="info(scope.$index)">查看佣金</el-button>
									<el-button type="primary" size="small" @click.native.prevent="contract(scope.$index)">合同号维护</el-button>

								</template>

							</el-table-column>
						</el-table>
						<el-pagination small @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
			<el-tab-pane label="佣金" name="second">

				<el-row :gutter="24">
					<el-col :span="1">
						<p class="queryLabel">时间:</p>
					</el-col>
					<el-col :span="4">
						<el-date-picker size="small" style="width: 100%;" v-model="conditions.date" format="yyyy-MM" :editable=false type="month" placeholder="时间">
						</el-date-picker>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">保险大类:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" style="width: 100%;" v-model="conditions.iscompulsoryinsurance" placeholder="请选择保险类别" clearable>
							<el-option v-for="item in insuranceCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">保险小类:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" style="width: 100%;" v-model="conditions.insureType" placeholder="请选择保险类别" clearable>
							<el-option label="新保" value="sb"></el-option>
							<el-option label="续保" value="xb"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">佣金类别:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" style="width: 100%;" v-model="conditions.commissionType" placeholder="请选择佣金类别" clearable>
							<el-option v-for="item in commissionCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
				</el-row>
				<el-row :gutter="24">
					<el-col :span="1">
						<p class="queryLabel">区域:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" v-model="conditions.oArea" @change="getCompanyInfo" style="width: 105%;" placeholder="请选择区域" clearable>
							<el-option v-for="item in areaCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">应用单位:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" style="width: 100%;" v-model="conditions.applyUnitId" placeholder="请选择公司名称" clearable>
							<el-option v-for="item in creatcompanyCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">保险公司:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" style="width: 100%;" v-model="conditions.companyId" placeholder="请选择保险类别" clearable>
							<el-option v-for="item in companyCombo" :label="item.insuranceCompanyName" :value="item.id"></el-option>
						</el-select>
					</el-col>
					<el-col :span="2" style="text-align: center">
						<el-button type="primary" size="small" v-on:click='commissionQuery'>查询</el-button>
					</el-col>
					<el-col :span="7" style="text-align: right">
						<!--						<el-button type="primary" size="small" v-on:click='audit' v-if="btnGroup.auditing">审核</el-button>
-->
						<el-button type="primary" size="small" v-on:click='addCommission'>新增</el-button>
						<el-button type="primary" size="small" v-on:click='editComs'>编辑</el-button>
						<el-button type="primary" size="small" v-on:click='startButton'>启用</el-button>
						<el-button type="primary" size="small" v-on:click='stopButton'>停用</el-button>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableDatas.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChanges" :row-class-name="tableRowClassName" @row-dblclick="examine">
							<el-table-column type="selection" width="60">
							</el-table-column>
							<el-table-column label="保险公司" prop="insuranceCompanyCode">
							</el-table-column>
							<el-table-column label="保险类别" prop="insuranceType" :formatter="insCov">
							</el-table-column>
							<el-table-column label="保单类别" prop="iscompulsoryinsurance">
							</el-table-column>
							<el-table-column label="投保类别" prop="insureType" :formatter="insureCov">
							</el-table-column>
							<el-table-column label="佣金类别" align="right" prop="commissionType" :formatter="commCov">
							</el-table-column>
							<el-table-column label="起始日期" align="right" prop="startDate">
							</el-table-column>
							<el-table-column label="终止日期" align="right" prop="stopDate">
							</el-table-column>
							<el-table-column label="佣金" align="right" prop="commission">
							</el-table-column>
							<el-table-column label="区域" align="right" prop="disp" width="110">
							</el-table-column>
							<el-table-column label="应用单位" align="right" prop="oName" :formatter="applyUnitCov" width="250">
							</el-table-column>
							<!--<el-table-column label="佣金状态" align="right" prop="status" :formatter="sCov" width="100">
							</el-table-column>-->
							<!--<el-table-column label="操作" align="right" prop="">
							</el-table-column>-->
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChanges" :current-page="CurentPages" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableDatas.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>

			<el-tab-pane label="合同号" name="third">

				<el-row :gutter="24">
					<el-col :span="1">
						<p class="queryLabel">时间:</p>
					</el-col>
					<el-col :span="4">
						<el-date-picker size="small" style="width: 100%;" v-model="contractQuerydata.year" :editable=false type="year" placeholder="时间">
						</el-date-picker>
					</el-col>

					<el-col :span="1">
						<p class="queryLabel">区域:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" v-model="contractQuerydata.area" style="width: 105%;" placeholder="请选择区域" clearable>
							<el-option v-for="item in areaCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>

					<el-col :span="1">
						<p class="queryLabel">保险公司:</p>
					</el-col>
					<el-col :span="4">
						<el-select size="small" style="width: 100%;" v-model="contractQuerydata.insuranceCompany" placeholder="请选择保险类别" clearable>
							<el-option v-for="item in companyCombo" :label="item.insuranceCompanyName" :value="item.id"></el-option>
						</el-select>
					</el-col>

					<el-col :span="2" style="text-align: center">
						<el-button type="primary" size="small" v-on:click='contractQuery'>查询</el-button>
					</el-col>
					<el-col :span="7" style="text-align: right">
						<!--						<el-button type="primary" size="small" v-on:click='audit' v-if="btnGroup.auditing">审核</el-button>
-->
						<el-button type="primary" size="small" @click='contractAdd'>新增</el-button>
						<!--<el-button type="primary" size="small" @click='contractAdd'>编辑</el-button>-->
						<el-button type="primary" size="small" @click='contractStart'>启用</el-button>
						<el-button type="primary" size="small" @click='contractStop'>停用</el-button>

					</el-col>

				</el-row>
				<el-row :gutter="24">

				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="contractResualtData.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChanges3">
							<el-table-column type="selection" width="60">
							</el-table-column>
							<el-table-column label="保险公司" :formatter="insuranceCompanyCov">
							</el-table-column>
							<el-table-column label="区域" :formatter="areaCov">
							</el-table-column>
							<el-table-column label="应用类型" :formatter="commonTypeCov">
							</el-table-column>
							<el-table-column label="保险类型" :formatter="insuranceTypeCov">
							</el-table-column>
							<el-table-column label="时间" prop="year">
							</el-table-column>
							<el-table-column label="合同号" prop="contractNo">
							</el-table-column>
							<el-table-column label="合同号长度" prop="lengthNumber">
							</el-table-column>
							<el-table-column label="状态" :formatter="statusCov">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange3" @current-change="handleCurrentChanges3" :current-page="CurentPages3" :page-sizes="page3.pageSizes" :page-size="page3.pageSize" layout=" total,prev, pager, next" :total="contractResualtData.total">
						</el-pagination>
					</el-col>
				</el-row>

			</el-tab-pane>

		</el-tabs>
		<el-dialog title="保险公司维护" v-model="comFormShow" size="small">
			<el-form :model="comFormData" ref="comForm" :rules="Rule" label-width="150px">
				<el-row :span="24">
					<el-col :span="12">
						<el-form-item label="公司名称：" prop="insuranceCompanyName">
							<el-input size="small" :maxlength="200" v-model="comFormData.insuranceCompanyName"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="简称：" prop="insuranceCompanyCode">
							<el-input size="small" :maxlength="200" v-model="comFormData.insuranceCompanyCode">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="公司代码：" prop="companyCode">
							<el-input size="small" :maxlength="200" v-model="comFormData.companyCode"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="负责人：" prop="responsiblePerson">
							<el-input size="small" :maxlength="200" v-model="comFormData.responsiblePerson">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="联系电话：" prop="conntactPhone">
							<el-input size="small" :maxlength="200" v-model="comFormData.conntactPhone"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="模板类型选择：" prop="templet">
							<el-select size="small" style="width: 100%;" v-model="comFormData.templet" placeholder="请选择模板类型" clearable>
								<el-option v-for="item in templetList" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="排列顺序：" prop="sort">
							<el-input size="small" :maxlength="200" v-model="comFormData.sort" type="number" placeholder="请输入排列顺序"></el-input>
						</el-form-item>
					</el-col>

				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='save'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="佣金维护" v-model="comFormShows" size="small">
			<el-form :model="comFormDatas.insurance" ref="comForms" :rules="yongjinRule" label-width="150px">
				<!--:rules="yongjinRule"-->
				<el-row :gutter="24">
					<el-col :span="12">
						<el-form-item label="保险类别：" required>
							<el-select size="small" style="width: 100%;" @change="insuranceTypeChange" v-model="hehe" placeholder="请选择保险类别" clearable>
								<el-option v-for="item in insuranceCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="投保类别：" prop="insureType">
							<el-select size="small" style="width: 100%;" v-model="comFormDatas.insurance.insureType" placeholder="请选择保险类别" clearable>
								<el-option label="新保" value="sb"></el-option>
								<el-option label="续保" value="xb"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="佣金类别：" prop="commissionType">
							<el-select size="small" style="width: 100%;" v-model="comFormDatas.insurance.commissionType" placeholder="请选择佣金类别" clearable>
								<el-option v-for="item in commissionCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12" v-if="jqShow">
						<el-form-item label="交强险费率：">
							<el-input type="number" style="width: 95%;" size="small" v-model="comFormDatas.insurance.jqCommission">
								<template slot="append">%</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12" v-if="jqShow">
						<el-form-item label="车船税佣金：" >
							<el-input type="number" style="width: 95%;" size="small" v-model="comFormDatas.insurance.ccsCommission">
								<template slot="append">%</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12" v-if="syShow">
						<el-form-item label="商业险费率：">
							<el-input type="number" style="width: 95%;" size="small" v-model="comFormDatas.insurance.syCommission">
								<template slot="append">%</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="起始日期：" prop="startDate">
							<el-date-picker size="small" style="width:95%" v-model="comFormDatas.insurance.startDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="开始日期" @change="setStopValue">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="终止日期：" prop="stopDate">
							<el-date-picker size="small" style="width:95%" v-model="comFormDatas.insurance.stopDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="终止日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="选择区域：" required>
							<el-select size="small" v-model="comFormDatas.insurance.area" style="width: 100%;" @change="companydata" placeholder="请选择区域" clearable>
								<el-option v-for="item in areaCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="应用单位：" prop="applyUnit">
							<el-select size="small" style="width: 100%;" v-model="comFormDatas.carCompany" placeholder="请选择应用单位" clearable :multiple="isMultiple">
								<el-option v-for="item in applyUnitCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="费率说明：" prop="remark">
							<el-input type="textarea" style="width: 95%;" :maxlength="200" v-model="comFormDatas.insurance.remark" :autosize="{ minRows: 2, maxRows: 4}" size="small">
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShows = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveCommission'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="编辑费率信息" v-model="editCommissionShow" size="small">
			<el-form :model="editFormData" ref="editForms" :rules="editRule" label-width="150px">
				<!--:rules="yongjinRule"-->
				<el-row :gutter="24">
					<el-col :span="12">
						<el-form-item label="保险类别：">
							<el-select size="small" disabled style="width: 100%;" v-model="editFormData.iscompulsoryinsurance" placeholder="请选择保险类别" clearable>
								<el-option v-for="item in insuranceCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="投保类别：" prop="insureType">
							<el-select size="small" style="width: 100%;" v-model="editFormData.insureType" placeholder="请选择保险类别" clearable>
								<el-option label="新保" value="sb"></el-option>
								<el-option label="续保" value="xb"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="佣金类别：" prop="commissionType">
							<el-select size="small" style="width: 100%;" v-model="editFormData.commissionType" placeholder="请选择佣金类别" clearable>
								<el-option v-for="item in commissionCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="费率：" prop="commission">
							<el-input type="number" style="width: 95%;" v-model="editFormData.commission">
								<template slot="append">%</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="起始日期：" prop="startDate">
							<el-date-picker size="small" style="width:95%" v-model="editFormData.startDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="开始日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="终止日期：" prop="stopDate">
							<el-date-picker size="small" style="width:95%" v-model="editFormData.stopDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="终止日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="选择区域：">
							<el-select size="small" disabled v-model="editFormData.area" style="width: 100%;" @change="companydata" placeholder="请选择区域" clearable>
								<el-option v-for="item in areaCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="应用单位：">
							<el-input style="width: 95%;" readonly :maxlength="200" v-model="editFormData.applyUnitName" :autosize="{ minRows: 2, maxRows: 4}" size="small">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="佣金说明：" prop="remark">
							<el-input type="textarea" style="width: 95%;" :maxlength="200" v-model="editFormData.remark" :autosize="{ minRows: 2, maxRows: 4}" size="small">
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="editCommissionShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveEditCommission'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="审核" v-model="auditShow" size="tiny">
			<div>
				<strong style="font-size: 16px;">佣金说明：</strong>
				<br><br>
				<strong style="font-size: 13px;">{{message}}</strong>
			</div>
			<br>
			<div style="font-size: 16px;">
				<el-row gutter="24">
					<el-col :span="8">
						<strong style="font-size: 16px;">审核说明:</strong>
					</el-col>
				</el-row>
				<el-row gutter="24">
					<el-col :span="24">
						<el-input size="small" v-model="remark" :maxlength="200" type="textarea"></el-input>
					</el-col>
				</el-row>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="danger" v-on:click='auditing(0)'>审核不通过</el-button>
				<el-button type="primary" v-on:click='auditing(1)'>审核通过</el-button>
			</div>
		</el-dialog>
		<el-dialog title="审核日志" v-model="examineShow" size="small">
			<el-row :gutter='24'>
				<el-table :data="tableDataList" border>
					<el-table-column label="审核人" prop="uName" width="100">
					</el-table-column>
					<el-table-column label="审核日期" prop="commissionDate" width="120">
					</el-table-column>
					<el-table-column label="审核说明" prop="remark">
					</el-table-column>
				</el-table>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="examineShow = false">关 闭</el-button>
			</div>
		</el-dialog>

		<el-dialog title="合同号维护" v-model="comFormShow2" size="small">
			<el-form :model="contractEditData" ref="contractForms" :rules="contractRule" label-width="150px">
				<el-row :span="24">
					<el-col :span="12">
						<el-form-item label="选择区域：" prop="area">
							<el-select size="small" v-model="contractEditData.area" @change="getCompanyInfo" style="width: 100%;" placeholder="请选择区域" clearable>
								<el-option v-for="item in areaCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="保险公司：" prop="insuranceCompany">
							<el-select size="small" style="width: 100%;" v-model="contractEditData.insuranceCompany" placeholder="请选择保险类别" clearable>
								<el-option v-for="item in companyCombo" :label="item.insuranceCompanyName" :value="item.id"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="应用年份：" prop="year">
							<el-date-picker size="small" style="width: 95%;" v-model="contractEditData.year" :editable=false type="year" placeholder="时间">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="应用类型：" prop="type">
							<el-select size="small" style="width: 100%;" v-model="contractEditData.commonType" placeholder="类型">
								<el-option v-for="item in commonType" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12" v-if="contractEditData.commonType == '0'">
						<el-form-item label="选择省份：" prop="oProvance">
							<el-select size="small" style="width: 100%;" filterable v-model="contractEditData.oProvance" @change="provinceChange" placeholder="省">
								<el-option v-for="item in provenCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12" v-if="contractEditData.commonType == '0'">
						<el-form-item label="选择城市：" prop="oCity">
							<el-select size="small" style="width: 100%;" filterable v-model="contractEditData.oCity" @change="cityChange" placeholder="市">
								<el-option v-for="item in cityCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>

					<el-col :span="12" v-if="contractEditData.commonType == '0'">
						<el-form-item label="选择县城：" prop="oCity">
							<el-select size="small" style="width: 100%;" filterable v-model="contractEditData.oAreas" placeholder="市">
								<el-option v-for="item in areasCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="合同类型：" prop="type">
							<el-select size="small" style="width: 100%;" v-model="contractEditData.type" placeholder="类型">
								<el-option v-for="item in contracttype" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="保单号：" prop="contractNo">
							<el-input size="small" v-model="contractEditData.contractNo">
							</el-input>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="保单号长度：" prop="contractNo">
							<el-input size="small" v-model="contractEditData.lengthNumber">
							</el-input>
						</el-form-item>
					</el-col>

				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShow2 = false">取 消</el-button>
				<el-button type="primary" v-on:click='contractSave'>提 交</el-button>
			</div>
		</el-dialog>

	</div>
</template>
<script>
	// import moment from 'moment'
	export default {
		data: function() {

			return {
				contracttype: [{
					label: '交强险',
					value: 'jq'
				}, {
					label: '商业险',
					value: 'sy'
				}],
				commonType: [{
					label: '城市',
					value: '0'
				}, {
					label: '通用',
					value: '1'
				}],
				//省下拉列表
				provenCombo: [],
				//市下拉列表
				cityCombo: [],
				//县城拉列表
				areasCombo: [],

				comFormShow2: false,
				/*合同号维护*/
				contractQuerydata: {
					year: "",
					area: "",
					insuranceCompany: "",
					id: "",

				},
				contractEditData: {
					year: "",
					area: "",
					insuranceCompany: "",
					contractNo: "",
					id: "",
					oProvance: "", // 省份
					oCity: "",
					oAreas: "",
					commonType: "",
					type: "",
					lengthNumber: "",

				},
				contractEditDataEntity: {
					year: "",
					area: "",
					insuranceCompany: "",
					contractNo: "",
					id: "",
					oProvance: "", // 省份
					oCity: "",
					oAreas: "",
					commonType: "",
					type: "",
					lengthNumber: "",
				},
				contractResualtData: {
					dataList: [],
					total: 0,
				},

				//编辑费率界面显示
				editCommissionShow: false,
				//编辑时不可修改
				addoredit: false,
				hehe: "", //保险类型
				//交强险佣金显示
				jqShow: false,
				//商业险佣金显示
				syShow: false,
				//公司
				creatcompanyCombo: [],
				examineShow: false,
				//审核说明
				remark: "",
				message: "",
				auditShow: false,
				btnGroup: {},
				isMultiple: true,
				insuranceCombo: [{
					label: '单交强',
					value: '0'
				}, {
					label: '单商业',
					value: '1'
				}, {
					label: '交商共保',
					value: '2'
				}],
				commissionCombo: [{
					label: '常规佣金',
					value: '0'
				}, {
					label: '促销佣金',
					value: '1'
				}],
				templetList: [{
						label: '不计免赔合并',
						value: '0'
					},
					{
						label: '不计免赔分离',
						value: '1'
					},
					{
						label: '不计免赔包含',
						value: '2'
					}
				],
				//应用单位
				applyUnitCombo: [],
				companyCombo: [],
				//页码数
				CurentPage: 1,
				CurentPages3: 1,
				CurentPages: 1,
				//每页的数量
				page: this.page,
				page3: this.page,
				pages: this.page,
				//公司数据
				tableData: {
					total: 0,
					dataList: []
				},
				//佣金数据
				//分组数据
				tableDatas: {
					total: 0,
					dataList: []
				},
				activeName: 'first',
				companyName: '',
				condition: {
					insuranceCompanyName: ""
				},
				conditions: {
					date: "",
					//公司
					applyUnitId: '',
					//保险公司
					companyId: "",
					//保险类别
					iscompulsoryinsurance: '',
					//投保类别
					insureType: '',
					//佣金类别
					commissionType: '',
					//区域
					oArea: ''
				},
				Emptyconditions: {
					date: "",
					companyId: "",
					//保险类别
					insuranceType: '',
					//投保类别
					insureType: '',
					//佣金类别
					commissionType: '',
					//区域
					oArea: ''
				},
				comFormShow: false,
				comFormShows: false,
				contractRule: {
					year: [{
						required: true,
						message: '请选择年份',
						type: 'date',
						trigger: 'blur'
					}],
					area: [{
						required: true,
						message: '请选择区域',
						trigger: 'blur'
					}],
					contractNo: [{
						required: true,
						message: '请输入合同号',
						trigger: 'blur'
					}],
					lengthNumber: [{
						required: true,
						message: '请输入合同号长度',
						trigger: 'blur'
					}],
					insuranceCompany: [{
						required: true,
						message: '请选择公司',
						trigger: 'blur'
					}],
					oProvance: [{
						required: true,
						message: '请选择省份',
						trigger: 'blur'
					}],
					oCity: [{
						required: true,
						message: '请选择城市',
						trigger: 'blur'
					}],
					type: [{
						required: true,
						message: '请选择类型',
						trigger: 'blur'
					}],
				},
				//校验规则
				Rule: {
					insuranceCompanyName: [{
						required: true,
						message: '请输入公司名称',
						trigger: 'blur'
					}],
					insuranceCompanyCode: [{
						required: true,
						message: '请输入公司简称',
						trigger: 'blur'
					}],
					contractJqNO: [{
						required: true,
						message: '请输入交强险合同号',
						trigger: 'blur'
					}],
					contractSyNO: [{
						required: true,
						message: '请输入商业险合同号',
						trigger: 'blur'
					}],
					contractLen: [{
						required: true,
						message: '请输入合同号长度限制',
						trigger: 'blur'
					}],
					templet: [{
						required: true,
						message: '请输入模板类型',
						trigger: 'blur'
					}],
					companyCode: [{
						required: true,
						message: '请输入公司代码',
						trigger: 'blur'
					}],
					responsiblePerson: [{
						required: true,
						message: '请输入负责人',
						trigger: 'blur'
					}],
					conntactPhone: [{
						required: true,
						message: '请输入联系 电话',
						trigger: 'blur'
					}],
				},
				//编辑校验规则
				editRule: {
					remark: [{
						required: true,
						message: '请输入佣金说明',
						trigger: 'blur'
					}],
					insureType: [{
						required: true,
						message: '请选择',
						trigger: 'blur'
					}],
					commissionType: [{
						required: true,
						message: '请选择',
						trigger: 'blur'
					}],
					commission: [{
						required: true,
						message: '请选择',
						trigger: 'blur'
					}],
					startDate: [{
						type: 'date',
						required: true,
						message: '请选择',
						trigger: 'blur'
					}],
					stopDate: [{
						type: 'date',
						required: true,
						message: '请选择',
						trigger: 'blur'
					}],
				},
				//校验规则
				yongjinRule: {
					remark: [{
						required: true,
						message: '请输入佣金说明',
						trigger: 'blur'
					}],
					area: [{
						required: true,
						message: '请选择区域',
						trigger: 'blur'
					}],
					//					iscompulsoryinsurance: [{
					//						required: true,
					//						message: '请选择保险类别',
					//						trigger: 'blur'
					//					}],
					insureType: [{
						required: true,
						message: '请选择投保类别',
						trigger: 'blur'
					}],
					commissionType: [{
						required: true,
						message: '请选择佣金类别',
						trigger: 'blur'
					}],
					syCommission: [{
						required: true,
						message: '请填写佣金',
						trigger: 'blur'
					}],
					jqCommission: [{
						required: true,
						message: '请填写佣金',
						trigger: 'blur'
					}],
					ccsCommission: [{
						required: true,
						message: '请填写佣金',
						trigger: 'blur'
					}],
					startDate: [{
						type: 'date',
						required: true,
						message: '请选择起始日期',
						trigger: 'blur'
					}],
					stopDate: [{
						type: 'date',
						required: true,
						message: '请选择终止日期',
						trigger: 'blur'
					}],
					//					applyUnit: [{
					//						required: true,
					//						message: '请选择应用单位',
					//						trigger: 'blur'
					//					}],
				},
				comFormData: {
					companyCode: "",
					updateUser: "",
					conntactPhone: "",
					update: "",
					checkDate: "",
					insuranceCompanyCode: "",
					insuranceStopDate: "",
					insuranceCompanyName: "",
					responsiblePerson: "",
					createTime: "",
					createUser: "",
					id: "",
					insuranceStartDate: "",
					status: "",
					contractJqNO: '',
					contractSyNO: '',
					contractLen: '', // 合同号长度
					templet: '', // 模板类型
					sort: 9999, //排列顺序
				},
				emptyData: {
					companyCode: "",
					updateUser: "",
					conntactPhone: "",
					update: "",
					checkDate: "",
					insuranceCompanyCode: "",
					insuranceStopDate: "",
					insuranceCompanyName: "",
					responsiblePerson: "",
					createTime: "",
					createUser: "",
					id: "",
					insuranceStartDate: "",
					status: "",
					contractJqNO: '',
					contractSyNO: '',
					contractLen: '', // 合同号长度
					templet: '', // 模板类型
					sort: 9999, //排列顺序
				},
				comFormDatas: {
					insurance: {
						status: '1',
						remark: '',
						area: "",
						companyId: "",
						createTime: "",
						updateUser: "",
						//投保类别
						iscompulsoryinsurance: '',
						insureType: '',
						createUser: "",
						update: "",
						commission: 1,
						id: "",
						insuranceType: "",
						commissionType: "",
						startDate: "",
						stopDate: "",
						insuranceCompanyName: "",
						jqCommission:"",
						syCommission:"",
						ccsCommission:"",
					},
					//应用单位
					carCompany: [],
				},
				editFormData: {
					iscompulsoryinsurance: '', //保单类别
					insureType: '', //保险类别
					commissionType: '', //佣金类别
					commission: '', //佣金
					startDate: '', //开始时间
					stopDate: '', //结束时间
					area: '', //区域 
					applyUnitName: '', //应用单位
					remark: '', //备注
				},
				editFormDataEmpty: {
					iscompulsoryinsurance: '', //保单类别
					insureType: '', //保险类别
					commissionType: '', //佣金类别
					commission: '', //佣金
					startDate: '', //开始时间
					stopDate: '', //结束时间
					area: '', //区域 
					applyUnitName: '', //应用单位
					remark: '', //备注
				},
				emptyDatas: {
					insurance: {
						status: '1',
						area: "",
						companyId: "",
						createTime: "",
						updateUser: "",
						//投保类别
						insureType: '',
						createUser: "",
						update: "",
						commission: 1,
						id: "",
						insuranceType: "",
						commissionType: "",
						startDate: "",
						stopDate: "",
						insuranceCompanyName: ""
					},
					//应用单位
					carCompany: [],
				},
				multipleSelection: [],
				multipleSelections: [],
				multipleSelections3: [],
				//区域下拉
				areaCombo: [],
				companyId: "",
				all: {
					0: "0_全部"
				},
				tableDataList: [],
			}
		},
		methods: {
			//佣金类型转换时触发的方法】
			insuranceTypeChange: function() {
				debugger;
				switch(this.$data.hehe) {
					case '0': //单交强
						this.$data.jqShow = true;
						this.$data.syShow = false;
						break;
					case '1': //单商业
						this.$data.syShow = true;
						this.$data.jqShow = false;
						break;
					case '2': //交商共保
						this.$data.jqShow = true;
						this.$data.syShow = true;
				};
			},
			//shenhe rizhi 
			//双击表格审核界面展示
			examine: function(row, event) {
				debugger;
				if(row.status == 0) {
					this.$message.error("该保险单未审核");
				} else {
					this.$http.get(this.API_ROOT + '/insurance/commission/confim/list', {
						params: {
							id: row.id
						}
					}).then(resp => {
						debugger;
						this.$data.examineShow = true;
						this.$data.tableDataList = resp.data.data;
					}, resp => {});
				}
			},
			audit: function() {
				debugger;
				if(this.$data.multipleSelections.length == 0) {
					this.$message.error("请选择数据");
				} else {
					this.$data.auditShow = true;
					this.$data.remark = "";
				}
			},
			//超出预警，标红
			tableRowClassName: function(row, index) {
				debugger;
				if(row.status == 0) {
					return 'positive-row';
				}
			},
			//yongjinzhuangtai
			sCov: function(row, column) {
				if(row.status == '0') {
					return '未审核'
				}
				if(row.status == '1') {
					return '审核通过'
				}
			},
			//状态转换
			statusCov: function(row, column) {
				return row.status == "1" ? '已启用' : '已停用';
			},
			//保险类别转换
			//状态转换
			insCov: function(row, column) {
				return row.insuranceType == "1" ? '商业险' : '交强险';
			},
			//状态转换
			commCov: function(row, column) {
				return row.commissionType == "1" ? '促销佣金' : '常规佣金';
			},
			//
			insureCov: function(row, column) {
				if(row.insureType == 'sb') {
					return '新保'
				} else {
					return '续保'
				}
			},
			//应用单位转换
			applyUnitCov: function(row, column) {
				//				console.error(JSON.stringify(row))
				if(row.applyUnit == '0') {
					return '全部'
				} else {
					return row.oName
				}
			},
			//选择框
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			},
			//选择框
			handleSelectionChanges3: function(val) {
				debugger;
				this.$data.multipleSelections3 = val;

			},
			//选择框
			handleSelectionChanges: function(val) {
				debugger;
				this.$data.multipleSelections = val;
				if(this.$data.multipleSelections.length > 1) {
					this.$message.error("请选择一条数据");
				} else if(this.$data.multipleSelections.length == 1) {
					debugger;
					this.$data.message = this.$data.multipleSelections[0].remark;
				}
			},
			//切换tab页
			handleClick: function(tab, event) {},
			add: function() {
				this.$data.comFormData = Object.assign(this.$data.comFormData, this.$data.emptyData);
				this.$data.comFormShow = true;
			},
			//shenhe
			auditing: function(type) {
				debugger;
				var newArray = [];
				newArray[0] = this.$data.comFormDatas.insurance;
				//				if(this.$data.remark == "") {
				//					this.$message.error("请填写审核说明！");
				//				} else {
				this.$http.post(this.API_ROOT + '/insurance/commission/confim', newArray, {
					params: {
						type: type,
						//							remark: this.$data.remark,
					}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						this.commissionQuery();
						//							this.$message(resp.data.msg);
						this.$data.comFormDatas.carCompany = "";

					} else {
						this.$message.error(resp.data.msg);
					}
					this.$data.auditShow = false;
				}, resp => {});
				//				}
			},
			//shenzeng 
			addCommission: function() {
				debugger;
				this.$data.hehe = "";
				this.$data.comFormDatas.carCompany = "";
				this.$data.comFormDatas.carCompany = [];
				this.$data.applyUnitCombo = [];
				var emptyDatas = {
					insurance: {
						remark: "",
						area: "",
						companyId: "",
						createTime: "",
						updateUser: "",
						//投保类别
						insureType: '',
						createUser: "",
						update: "",
						commission: "",
						id: "",
						insuranceType: "",
						commissionType: "",
						startDate: "",
						stopDate: "",
						insuranceCompanyName: "",
						jqCommission:"",
						syCommission:"",
						ccsCommission:"",
					},
					//应用单位
					carCompany: [],
				};
				this.$data.comFormDatas = Object.assign(this.$data.comFormDatas, emptyDatas);
				this.$data.comFormDatas.insurance.companyId = this.$data.conditions.companyId;
				this.$data.comFormShows = true;
				this.$data.isMultiple = true;

			},
			//启用车系
			startCom: function() {
				if(this.$data.multipleSelection.length == 1) {
					debugger;
					var resRoleData = this.$data.multipleSelection[0];
					this.$http({
						method: 'POST',
						url: this.API_ROOT + '/insurance/start',
						params: {
							id: resRoleData.id,
						}
					}).then(function(resp) {
						debugger;
						this.companyQuery();
					}, function(error) {})
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//停用车系
			stopCom: function() {
				if(this.$data.multipleSelection.length == 1) {
					var resRoleData = this.$data.multipleSelection[0];
					this.$http({
						method: 'POST',
						url: this.API_ROOT + '/insurance/stop',
						params: {
							id: resRoleData.id,
						}
					}).then(function(resp) {
						this.companyQuery();
					}, function(error) {})
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//编辑公司
			editCom: function() {
				if(this.$data.multipleSelection.length == 1) {
					var resRoleData = this.$data.multipleSelection[0];
					this.$http.get(this.API_ROOT + '/insurance/info', {
						params: {
							id: resRoleData.id
						}
					}).then((response) => {
						debugger;
						this.$data.comFormData = Object.assign(this.$data.comFormData, response.data.data);
					}, (response) => {
						// error callback
					});
					this.$data.comFormShow = true;
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//编辑佣金
			editComs: function() {
				if(this.$data.multipleSelections.length == 1) {
					this.$data.isMultiple = false;
					var resRoleData = this.$data.multipleSelections[0];
					this.$http.get(this.API_ROOT + '/insurance/commission/info', {
						params: {
							id: resRoleData.id
						}
					}).then((response) => {
						debugger;
						this.$data.editFormData = Object.assign(this.$data.comFormDatas.insurance, response.data.data);
						this.$data.editFormData.startDate = new Date(this.$data.editFormData.startDate);
						this.$data.editFormData.stopDate = new Date(this.$data.editFormData.stopDate);
					}, (response) => {
						// error callback
					});
					this.$data.editCommissionShow = true; //编辑费率界面显示

				} else {
					this.$message.error("请选择一条数据");
				}
			},
			// 停用
			stopButton: function() {
				if(this.$data.multipleSelections.length == 1) {
					var temp = this.$data.multipleSelections[0].id;
					//alert("停用");
					debugger;
					this.$http.get(this.API_ROOT + '/insurance/commission/disable', {
						params: {
							id: temp
						}
					}).then(resp => {
						if(resp.data.success) {
							this.$message(resp.data.msg);
							this.$data.multipleSelections = [];
							this.commissionQuery();

						} else {
							//debugger;
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
				} else {
					this.$message.error("请选择一条数据");
				}

			},
			// 启用
			startButton: function() {
				if(this.$data.multipleSelections.length == 1) {
					var temp = this.$data.multipleSelections[0].id;
					//alert("停用");
					debugger;
					this.$http.get(this.API_ROOT + '/insurance/commission/enable', {
						params: {
							id: temp
						}
					}).then(resp => {
						if(resp.data.success) {
							this.$message(resp.data.msg);
							this.$data.multipleSelections = [];
							this.commissionQuery();

						} else {
							//debugger;
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//查询公司
			companyQuery: function() {
				this.$http.post(this.API_ROOT + '/insurance/page', this.$data.condition, {
					params: {
						start: this.$data.CurentPage,
						limit: this.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.tableData = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//查询佣金
			commissionQuery: function() {
				if(this.$data.conditions.date == '' || this.$data.conditions.date == null || this.$data.conditions.date == undefined) {
					this.$data.conditions.date = ''
				} else {
					this.$data.conditions.date = this.moment(this.$data.conditions.date).format("YYYY-MM");
				}
				this.$http.post(this.API_ROOT + '/insurance/commission/page/new', this.$data.conditions, {
					params: {
						start: this.$data.CurentPages,
						limit: this.page.pageSize
					}
				}).then(resp => {
					debugger;
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.tableDatas = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//查看佣金
			info: function(index) {
				this.$data.conditions.companyId = this.$data.tableData.dataList[index].id;
				//				this.$data.comFormDatas.insurance.companyId = this.$data.tableData.dataList[index].id;
				debugger;
				//				this.$data.conditions = Object.assign(this.$data.conditions,this.$data.Emptyconditions);
				this.commissionQuery();
				this.$data.activeName = "second";
				this.companyUpdata();
			},

			// 合同号查询
			contractQuery: function() {
				debugger;
				if(this.$data.contractQuerydata.year == '' || this.$data.contractQuerydata.year == null || this.$data.contractQuerydata.year == undefined) {
					this.$data.contractQuerydata.year = ''
				} else {
					this.$data.contractQuerydata.year = this.moment(this.$data.contractQuerydata.year).format("YYYY");
				}

				this.$http.post(this.API_ROOT + '/insurance/contract/page', this.$data.contractQuerydata, {
					params: {
						page: this.$data.CurentPages3,
						limit: this.page3.pageSize
					}
				}).then(resp => {
					debugger;
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.contractResualtData = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;

					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
				this.$data.contractQuerydata.year = "";

			},
			// 新增
			contractAdd: function() {
				this.$data.contractEditData = Object.assign(this.$data.contractEditData, this.$data.contractEditDataEntity);
				this.$data.comFormShow2 = true;
			},
			contractStop: function() {

				debugger;
				if(this.$data.multipleSelections3.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}

				this.$http.get(this.API_ROOT + '/insurance/contract/stop', {
					params: {
						id: this.$data.multipleSelections3[0].id,
					}
				}).then((response) => {
					if(response.data.success) {
						this.$message("停用成功！");
						this.contractQuery();
					} else {
						this.$message.error("停用失败！");
					}
					this.$data.multipleSelections = [];

				}, (response) => {})
			},
			// 启用
			contractStart: function() {

				debugger;
				if(this.$data.multipleSelections3.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}

				this.$http.get(this.API_ROOT + '/insurance/contract/start', {
					params: {
						id: this.$data.multipleSelections3[0].id,
					}
				}).then((response) => {
					if(response.data.success) {
						this.$message("启用成功！");
						this.contractQuery();
					} else {
						this.$message.error("启用失败！");
					}
					this.$data.multipleSelections = [];

				}, (response) => {});
			},
			//提交
			contractSave: function() {
				this.$data.contractEditData.year = new Date(this.$data.contractEditData.year);

				this.$refs.contractForms.validate(function(valid, $event) {
					//parserDate();

					// 验证通过
					if(valid) {
						//alert("提交成功！！");	
						debugger;
						if(this.$data.contractEditData.year == '' || this.$data.contractEditData.year == null || this.$data.contractEditData.year == undefined) {
							this.$data.contractEditData.year = ''
						} else {
							this.$data.contractEditData.year = this.moment(this.$data.contractEditData.year).format("YYYY");
						}

						this.$http.post(this.API_ROOT + '/insurance/contract/update', this.$data.contractEditData)
							.then(resp => {
								if(resp.data.success) {
									debugger;

									this.contractQuery();
									this.$data.comFormShow2 = false;
									this.$message("提交成功");

								} else {
									debugger;
									this.$message.error(resp.data.msg);
								}

							}, resp => {

							});
					} else {
						this.$message.error("信息填写不全！");
					}

				}.bind(this));

			},

			//合同号维护
			contract: function(index) {
				//this.$data.conditions.companyId = this.$data.tableData.dataList[index].id;
				this.$data.contractQuerydata.insuranceCompany = this.$data.tableData.dataList[index].id;
				//				this.$data.comFormDatas.insurance.companyId = this.$data.tableData.dataList[index].id;
				debugger;
				this.contractQuery();
				this.$data.activeName = "third";
			},

			//保存
			save: function() {
				debugger;
				this.$refs.comForm.validate(function(valid, $event) {
					// 验证通过
					if(valid) {
						this.$http.post(this.API_ROOT + '/insurance/save', this.$data.comFormData)
							.then(resp => {
								if(resp.data.success) {
									debugger;
									this.companyQuery();
									this.$data.comFormShow = false;
									this.$message(resp.data.msg);
								} else {
									this.$message.error(resp.data.msg);
								}
							}, resp => {

							});
					}
				}.bind(this))
			},

			//省选择值变动
			provinceChange: function(data) {

				debugger;
				this.$data.contractEditData.oCity = "";
				this.queryCity(data);
				debugger;
			},
			//城市值变动
			cityChange: function(data) {

				debugger;
				this.$data.contractEditData.oAreas = "";
				this.queryAreas(data);
				debugger;
			},
			/*城市下拉*/
			queryCity: function(pid) { /*350000福建省*/
				debugger;
				//获取城市下拉
				this.$http.get(this.API_ROOT + '/base/province/combo/city', {
					params: {
						id: pid
					}
				}).then((response) => {
					if(response.data.success) {
						this.$data.cityCombo = response.data.dataList;
						debugger;
						if(this.$data.contractEditData.oCity == "") {
							this.$data.contractEditData.oCity = response.data.dataList[0].value;
						}

					}

				}, (response) => {});

			},

			/*县城下拉*/
			queryAreas: function(cid) { /*350000福建省*/
				debugger;
				//获取城市下拉
				this.$http.get(this.API_ROOT + '/base/province/combo/areas', {
					params: {
						cityid: cid
					}
				}).then((response) => {
					if(response.data.success) {
						this.$data.areasCombo = response.data.dataList;
						debugger;
						if(this.$data.contractEditData.oAreas == "") {
							this.$data.contractEditData.oAreas = response.data.dataList[0].value;
						}
					}
				}, (response) => {});

			},

			//佣金保存
			saveCommission: function() {
				debugger;
				if(this.$data.hehe == "") {
					this.$message.error("请选择保险类型");
				} else if(this.$data.comFormDatas.carCompany.length == 0) {
					this.$message.error("请选择应用单位");
				} else {
					if(this.$data.comFormDatas.insurance.jqCommission) {
						this.$data.comFormDatas.insurance.jqCommission = Number(this.$data.comFormDatas.insurance.jqCommission).toFixed(2);
					}
					if(this.$data.comFormDatas.insurance.syCommission) {
						this.$data.comFormDatas.insurance.syCommission = Number(this.$data.comFormDatas.insurance.syCommission).toFixed(2);
					}
					this.$data.comFormDatas.insurance.iscompulsoryinsurance = this.$data.hehe;
					this.$refs.comForms.validate(function(valid, $event) {
						// 验证通过
						if(valid) {
							debugger;
							this.$data.comFormDatas.insurance.startDate = this.moment(this.$data.comFormDatas.insurance.startDate).format("YYYY-MM-DD");
							this.$data.comFormDatas.insurance.stopDate = this.moment(this.$data.comFormDatas.insurance.stopDate).format("YYYY-MM-DD");
							this.$data.comFormDatas.insurance.ccsCommission = Number(this.$data.comFormDatas.insurance.ccsCommission).toFixed(2);
							this.$http.post(this.API_ROOT + '/insurance/commission/save/new', this.$data.comFormDatas)
								.then(resp => {
									if(resp.data.success) {
										this.$message(resp.data.msg);
										debugger;
										//												this.auditing(1);
										this.commissionQuery();
										//												this.commissionQuery();
										this.$data.comFormShows = false;
										this.$data.editCommissionShow = false; //编辑佣金界面
									} else {
										this.$message.error(resp.data.msg);
										this.$data.comFormDatas.insurance.startDate = new Date(this.$data.comFormDatas.insurance.startDate);
										this.$data.comFormDatas.insurance.stopDate = new Date(this.$data.comFormDatas.insurance.stopDate);
									}
								}, resp => {});
						} else {
							return false
						}
					}.bind(this))
				}

			},
			//佣金保存
			saveEditCommission: function() {
				debugger;
				this.$refs.editForms.validate(function(valid, $event) {
					// 验证通过
					if(valid) {
						debugger;
						this.$data.editFormData.startDate = this.moment(this.$data.editFormData.startDate).format("YYYY-MM-DD");
						this.$data.editFormData.stopDate = this.moment(this.$data.editFormData.stopDate).format("YYYY-MM-DD");
						this.$http.post(this.API_ROOT + '/insurance/commission/update', this.$data.editFormData)
							.then(resp => {
								if(resp.data.success) {
									this.$message(resp.data.msg);
									debugger;
									this.commissionQuery();
									this.$data.editCommissionShow = false; //编辑佣金界面
								} else {
									this.$message.error(resp.data.msg);
									this.$data.editFormData.startDate = new Date(this.$data.editFormData.startDate);
									this.$data.editFormData.stopDate = new Date(this.$data.editFormData.stopDate);
								}
							}, resp => {});
					}
				}.bind(this))
			},
			//获取应用单位
			companydata: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/rbac/dept/deptStoreArea', {
					params: {
						storeParea: this.$data.comFormDatas.insurance.area,
					}
				}).then((response) => {
					this.$data.applyUnitCombo = response.data.dataList;
				}, (response) => {});
			},
			//获取应用单位
			companydatas: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/insurance/commission/carCompanys', {
					params: {
						area: this.$data.comFormDatas.insurance.area,
					}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						this.$data.applyUnitCombo = resp.data.data;
						//						console.log(JSON.stringify(resp.data.data))
					} else {

					}
				}, resp => {});
			},
			//设置结束日期的默认值
			setStopValue: function(val) {
				//				console.error(val);
				//				this.$data.comFormDatas.insurance.stopDate = moment(val).add(1, 'months').add(-1,'day');
				//结束日期为当月最后一天
				debugger;
				var time = new Date(this.$data.comFormDatas.insurance.startDate);
				var year = time.getFullYear();
				var month = time.getMonth() + 1;
				if(month > 11) {
					month -= 12; //月份减     
					year++; //年份增 
				};
				var newDate = new Date(year, month, 1);
				var date1 = newDate.getTime();
				var date2 = newDate.getTime() - 1000 * 60 * 60 * 24;
				var date3 = new Date(newDate.getTime() - 1000 * 60 * 60 * 24);
				this.$data.comFormDatas.insurance.stopDate = date3;
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				debugger;
				this.$data.CurentPage = currentPage;
				//this.$data.dictGroup = '';
				this.companyQuery();
			},

			//列表，分页大小切换
			handleSizeChange3: function() {},
			//列表,当前页切换
			handleCurrentChanges3: function(currentPage) {
				this.$data.CurentPage3 = currentPage;
				//this.$data.dictGroup = '';
				this.contractQuery();
				//this.companyQuery();
			},

			handleCurrentChanges: function(currentPage) {
				debugger;
				this.$data.CurentPages = currentPage;
				//this.$data.dictGroup = '';
				this.commissionQuery();
			},
			companyUpdata: function() {
				//获取保险公司下拉
				this.$http.get(this.API_ROOT + '/insurance/companys', {
					params: {}
				}).then((response) => {
					debugger;
					this.$data.companyCombo = response.data.data;
				}, (response) => {});
			},
			//获取公司信息
			getCompanyInfo: function() {
				//this.$data.data.companyId = ""; //清空单位
				this.$data.conditions.applyUnitId = ""; //清空单位
				this.$data.creatcompanyCombo = [];
				debugger;
				this.$http.get(this.API_ROOT + '/rbac/dept/deptStoreArea', {
					params: {
						storeParea: this.$data.conditions.oArea,
					}
				}).then((response) => {
					this.$data.creatcompanyCombo = response.data.dataList;
					if(this.$data.creatcompanyCombo.length > 0) {
						this.$data.conditions.applyUnitId = this.$data.creatcompanyCombo[0].value;
					}
				}, (response) => {});
			},
			//获取区域
			getarea: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/base/dict/combo', {
					params: {
						group: "area"
					}
				}).then((response) => {
					this.$data.areaCombo = response.data;
				}, (response) => {});
			},
			insuranceCompanyCov: function(cow) {
				debugger;
				for(var i = 0; i < this.$data.companyCombo.length; i++) {
					if(cow.insuranceCompanyId == this.$data.companyCombo[i].id) {
						return this.$data.companyCombo[i].insuranceCompanyName;
					}
				}
				return "未知";

			},

			areaCov: function(cow) {
				debugger;
				for(var i = 0; i < this.$data.areaCombo.length; i++) {
					if(cow.area == this.$data.areaCombo[i].code) {
						return this.$data.areaCombo[i].label;
					}
				}
				return "未知";

			},
			//应用类型解析区域（0）通用（1）
			commonTypeCov: function(row) {
				return row.commonType == "0" ? "城市" : "通用";
			},
			//保险类型解析交强险（jq）商业险（商业）
			insuranceTypeCov: function(row) {
				return row.type == "jq" ? "交强险" : "商业险";
			},
		},
		//表单创建时执行
		created: function() {
			this.getarea();
			this.companyQuery();			
			//获取省下拉
			this.$http.get(this.API_ROOT + '/base/province/combo/province', {
				params: {

				}
			}).then((response) => {
				this.$data.provenCombo = response.data;
			}, (response) => {});
			//获取保险公司下拉
			this.$http.get(this.API_ROOT + '/insurance/companys', {
				params: {}
			}).then((response) => {
				debugger;
				this.$data.companyCombo = response.data.data;
			}, (response) => {});
			//获取按钮权限
			this.$http({
				method: 'GET',
				url: this.API_ROOT + '/rbac/login/btn', //url 输出 按照车牌号的 车牌号
				params: { //发送的参数
					resPath: "bx/insCompany", ////查询条件 按照输入的车牌号
				}
			}).then(function(resp) {
				debugger;
				var btnData = resp.data.dataList;

				var temp = {};

				for(var i = 0; i < btnData.length; i++) {

					var btnName = btnData[i].btnName;

					temp[btnName] = btnName;

				}

				Object.assign(this.$data.btnGroup, temp);
			}, function(error) {
				// error
			});
		}

	}
</script>
<style>
	.el-table .info-row {
		height: 10px !important;
	}
	
	.item {
		width: 30px;
	}
	
	.el-form-item {
		clear: both;
	}
	
	.el-dropdown .el-button-group,
	.el-table .el-tooltip,
	.el-table .el-tooltip__rel {
		display: inline;
	}
	
	.el-table {
		height: 100%;
		width: 100%;
	}
	
	#el-select {
		width: 200px;
	}
	
	.el-table .positive-row {
		background: #fb8e7c;
	}
</style>